# config/settings.py
"""
统一项目配置文件
所有路径、常量、默认值集中管理
"""

from pathlib import Path

# 应用路径配置
APP_CONFIG = {
    "exe_path": r'D:\上位机\8月\SSD001B-Label-Relation-System-Rev1.1.2\SSD001B-Label-Relation-System-Install-Rev1.1.2\Test-System.exe',
    "backend": "win32"
}

# ==================== 项目路径 ====================
# 项目根目录：自动定位到 1.Label-Relation/
PROJECT_ROOT = Path(__file__).parent.parent  # settings.py → config → 项目根

# 日志目录
LOGS_DIR = PROJECT_ROOT / "logs"
SCREENSHOTS_DIR = LOGS_DIR / "screenshots"

# 确保目录存在
def setup_directories():
    """创建必要目录"""
    LOGS_DIR.mkdir(exist_ok=True)
    SCREENSHOTS_DIR.mkdir(exist_ok=True)

# 立即执行一次，确保目录存在
setup_directories()


# ==================== 日志配置 ====================
LOG_PATTERN = "test_*.log"           # 日志文件匹配模式
DEFAULT_LOG_KEEP_COUNT = 20          # 默认保留最新 N 个日志
LOG_FILE_PREFIX = "test"             # 日志文件前缀

# ==================== 弹窗配置 ====================
POPUP_SCREENSHOT_PREFIX = "popup_error"  # 截图文件前缀

# ==================== 其他常量 ====================
APP_NAME = "条码关联系统"
DEBUG = True